<template>
    <div>
        <h1>修改排序</h1>
        <input type="text" v-model="data.sort" >
        <br>
        <input type="button" value="修改排序" @click="UpdateSort">
        <input type="button" value="返回" @click="Cnacel">
    </div>
</template>

<script setup lang="ts">

import { ref,onMounted } from 'vue';
import { useRoute,useRouter } from 'vue-router';
import axios from 'axios';

const route = useRoute()
const router = useRouter()
const data=ref({
    id:0,
    sort:0
})

const Cnacel=()=>{
    router.push('/Show')
}
const UpdateSort=()=>{
    data.value.id  =  route.query.id;
    axios.get("https://localhost:7275/api/HousePrice/UpdateSort",{params:data.value}).then(res=>{
        if(res.data>0){
            alert('成功')
            router.push('/')
        }
        else{
            alert('修改失败了。。。。')
        }
    })
}

</script>

<style scoped>

</style>